import axios from 'axios';

export interface IAjax {
    errorCode: string;
    msg: string;
    data: any
}

const ajax = axios.create({
    baseURL: '/',
    timeout: 1000,
});
/**
 * 请求拦截器
 * */
ajax.interceptors.request.use(function (config) {
    return config;
}, function (error) {
    return Promise.reject(error);
});
/**
 * 响应拦截器
 * */
ajax.interceptors.response.use(function (response) {
    return response.data;
}, function (error) {
    return Promise.reject(error);
});

export default ajax;
